package com.kaibes.module.jwt.local;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kaibes.core.spring.proxy.Proxy;
import com.kaibes.module.jwt.service.SecurityService;
import com.kaibes.module.user.UserService;

@Service
public class SecurityService4Jwt implements SecurityService {
    
    @Autowired
    private UserService userService;
    @Proxy
    private AuthorityService authorityService;

    @Override
    public List<String> listAuthoritiesByUserId(Integer userId) {
        Integer roleId = userService.getRoleIdById(userId);
        List<String> authorities = authorityService.listByRoleId(roleId);
        return authorities;
    }

}
